# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[UIItem.__init__(self, *args, **kw)
self.selected_style_string = xml_tag(self.style['selected_font_style'].replace('%', '%%'), '%s')
self.not_selected_style_string = xml_tag(self.style['font_style'].replace('%', '%%'), '%s')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb772ac2c>}
nname: 68
n 68(None)[log.debug("%s don't exist" % name)
return None
]:
	i: 0(AL), 67()
	o: 

nname: 67
n 67(None)[]:
	i: 13(AF), 63()
	o: 68()

nname: 63
n 63(None)[]:
	i: 27(f), 55()
	o: 67()

nname: 55
n 55(None)[return name
continue
]:
	i: 27(t)
	o: 63()

nname: 27
n 27(path.isfile(name))[for ext in self.style['extension']:
name = _name + ext
]:
	i: 13(for)
	o: 55(t), 63(f)

nname: 13
n 13(None)[]:
	i: 0(loop)
	o: 27(for), 67(AF)

nname: 0
n 0(None)[_name = root + suf
]:
	i: 
	o: 13(loop), 68(AL)

nname: 68
n 68(None)[log.debug("%s don't exist" % name)
return None
]:
	i: 0(AL), 13(AF), 27()
	o: 

nname: 27
n 27(None)[for ext in self.style['extension']:
name = _name + ext
if path.isfile(name):
	return name
	continue
]:
	i: 13(for)
	o: 68()

nname: 13
n 13(None)[]:
	i: 0(loop)
	o: 27(for), 68(AF)

nname: 0
n 0(None)[_name = root + suf
]:
	i: 
	o: 13(loop), 68(AL)

nname: 27
n 27(None)[for ext in self.style['extension']:
	name = _name + ext
	if path.isfile(name):
		return name
		continue
log.debug("%s don't exist" % name)
return None
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[_name = root + suf
]:
	i: 
	o: 27(for)

nname: 0
n 0(None)[_name = root + suf
for ext in self.style['extension']:
	name = _name + ext
	if path.isfile(name):
		return name
		continue
log.debug("%s don't exist" % name)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb772f32c>}
nname: 0
n 0(None)[repository = self.style['repository']
root = path.join(repository, '%s' % item.type)
suff = ('.', '_selected.')
def check_concat(suf):
	_name = root + suf
	for ext in self.style['extension']:
		name = _name + ext
		if path.isfile(name):
			return name
			continue
	log.debug("%s don't exist" % name)
	return None

return map(check_concat, suff)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb772aaec>}
nname: 377
n 377(None)[return None
]:
	i: 233(JA), 283(JA), 354(), 357()
	o: 

nname: 357
n 357(None)[self.widget.set_color(a=0)
]:
	i: 0(f)
	o: 377()

nname: 283
n 283(None)[name = name.encode('ascii', 'replace')
self.text_not_sel.set_text(self.not_selected_style_string % name)
self.text_sel.set_text(self.selected_style_string % name)
]:
	i: 97(except)
	o: 377(JA)

nname: 233
n 233(None)[self.text_not_sel.set_text(self.not_selected_style_string % name)
self.text_sel.set_text(self.selected_style_string % name)
]:
	i: 97(try)
	o: 377(JA)

nname: 97
n 97(None)[self.thumbnail_sel.update(signal=None, sender=None, value=item_thumbnail)
self.thumbnail_not_sel.update(signal=None, sender=None, value=item_thumbnail)
self.background_sel.update(signal=None, sender=None, value=back_sel)
self.background_not_sel.update(signal=None, sender=None, value=back_not_sel)
name = item.name
]:
	i: 72(JA), 86(JA), 93(), 96()
	o: 233(try), 283(except)

nname: 96
n 96(None)[]:
	i: 25(f)
	o: 97()

nname: 86
n 86(None)[]:
	i: 68(except)
	o: 97(JA)

nname: 72
n 72(None)[item_thumbnail = item['thumbnail']
]:
	i: 68(try)
	o: 97(JA)

nname: 68
n 68(None)[]:
	i: 25(t)
	o: 72(try), 86(except)

nname: 25
n 25(item.type in ('audio', 'image', 'video', 'video_image'))[back_not_sel, back_sel = self._get_images_paths(item)
item_thumbnail = None
]:
	i: 0(t)
	o: 68(t), 96(f)

nname: 0
n 0(item)[UIItem.reset(self, item, selected)
]:
	i: 
	o: 25(t), 357(f)

nname: 377
n 377(None)[return None
]:
	i: 283(JA), 354(), 357()
	o: 

nname: 357
n 357(None)[self.widget.set_color(a=0)
]:
	i: 0(f)
	o: 377()

nname: 283
n 283(None)[except:
	name = name.encode('ascii', 'replace')
	self.text_not_sel.set_text(self.not_selected_style_string % name)
	self.text_sel.set_text(self.selected_style_string % name)
]:
	i: 97()
	o: 377(JA)

nname: 97
n 97(None)[self.thumbnail_sel.update(signal=None, sender=None, value=item_thumbnail)
self.thumbnail_not_sel.update(signal=None, sender=None, value=item_thumbnail)
self.background_sel.update(signal=None, sender=None, value=back_sel)
self.background_not_sel.update(signal=None, sender=None, value=back_not_sel)
name = item.name
try:
	self.text_not_sel.set_text(self.not_selected_style_string % name)
	self.text_sel.set_text(self.selected_style_string % name)
]:
	i: 86(JA), 93(), 25(f)
	o: 283()

nname: 86
n 86(None)[except:
	pass
]:
	i: 68()
	o: 97(JA)

nname: 68
n 68(None)[try:
	item_thumbnail = item['thumbnail']
]:
	i: 25(t)
	o: 86()

nname: 25
n 25(item.type in ('audio', 'image', 'video', 'video_image'))[back_not_sel, back_sel = self._get_images_paths(item)
item_thumbnail = None
]:
	i: 0(t)
	o: 68(t), 97(f)

nname: 0
n 0(item)[UIItem.reset(self, item, selected)
]:
	i: 
	o: 25(t), 357(f)

nname: 377
n 377(None)[return None
]:
	i: 97(JA), 354(), 357()
	o: 

nname: 357
n 357(None)[self.widget.set_color(a=0)
]:
	i: 0(f)
	o: 377()

nname: 97
n 97(None)[self.thumbnail_sel.update(signal=None, sender=None, value=item_thumbnail)
self.thumbnail_not_sel.update(signal=None, sender=None, value=item_thumbnail)
self.background_sel.update(signal=None, sender=None, value=back_sel)
self.background_not_sel.update(signal=None, sender=None, value=back_not_sel)
name = item.name
try:
	self.text_not_sel.set_text(self.not_selected_style_string % name)
	self.text_sel.set_text(self.selected_style_string % name)
except:
	name = name.encode('ascii', 'replace')
	self.text_not_sel.set_text(self.not_selected_style_string % name)
	self.text_sel.set_text(self.selected_style_string % name)
]:
	i: 68(JA), 93(), 25(f)
	o: 377(JA)

nname: 68
n 68(None)[try:
	item_thumbnail = item['thumbnail']
except:
	pass
]:
	i: 25(t)
	o: 97(JA)

nname: 25
n 25(item.type in ('audio', 'image', 'video', 'video_image'))[back_not_sel, back_sel = self._get_images_paths(item)
item_thumbnail = None
]:
	i: 0(t)
	o: 68(t), 97(f)

nname: 0
n 0(item)[UIItem.reset(self, item, selected)
]:
	i: 
	o: 25(t), 357(f)

nname: 377
n 377(None)[return None
]:
	i: 97(JA), 354(), 357()
	o: 

nname: 357
n 357(None)[self.widget.set_color(a=0)
]:
	i: 0(f)
	o: 377()

nname: 97
n 97(None)[self.thumbnail_sel.update(signal=None, sender=None, value=item_thumbnail)
self.thumbnail_not_sel.update(signal=None, sender=None, value=item_thumbnail)
self.background_sel.update(signal=None, sender=None, value=back_sel)
self.background_not_sel.update(signal=None, sender=None, value=back_not_sel)
name = item.name
try:
	self.text_not_sel.set_text(self.not_selected_style_string % name)
	self.text_sel.set_text(self.selected_style_string % name)
except:
	name = name.encode('ascii', 'replace')
	self.text_not_sel.set_text(self.not_selected_style_string % name)
	self.text_sel.set_text(self.selected_style_string % name)
]:
	i: 93(), 25(f)
	o: 377(JA)

nname: 25
n 25(None)[back_not_sel, back_sel = self._get_images_paths(item)
item_thumbnail = None
if item.type in ('audio', 'image', 'video', 'video_image'):
	try:
		item_thumbnail = item['thumbnail']
	except:
		pass
]:
	i: 0(t)
	o: 97(JA)

nname: 0
n 0(item)[UIItem.reset(self, item, selected)
]:
	i: 
	o: 25(t), 357(f)

self.nodes: {0: <unpyclib.structure.node instance at 0xb772cf6c>, 354: <unpyclib.structure.node instance at 0xb772c30c>, 357: <unpyclib.structure.node instance at 0xb772c34c>, 97: <unpyclib.structure.node instance at 0xb772ff6c>, 353: <unpyclib.structure.node instance at 0xb772c2cc>, 377: <unpyclib.structure.node instance at 0xb772c38c>, 25: <unpyclib.structure.node instance at 0xb772fe4c>, 92: <unpyclib.structure.node instance at 0xb772c14c>, 93: <unpyclib.structure.node instance at 0xb772c18c>}
nname: 199
n 199(None)[thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
background_not_sel.resize(width=icon_size[0], height=icon_size[1])
thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
text_not_sel = TextBlock()
text_not_sel.set_color(color=style['text_color'])
text_sel = TextBlock()
text_sel.set_color(color=style['selected_text_color'])
self.text_not_sel = text_not_sel
self.text_sel = text_sel
self.thumbnail_not_sel = thumbnail_not_sel
self.thumbnail_sel = thumbnail_sel
self.background_not_sel = background_not_sel
self.background_sel = background_sel
c = Container()
c_sel = Container()
tw, th = style['text_size']
iw, ih = style['icon_size']
itw, ith = style['item_size']
c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
tw, th = style['selected_text_size']
iw, ih = style['selected_icon_size']
itw, ith = style['selected_item_size']
c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
return (c, c_sel)
]:
	i: 0(AL), 198()
	o: 

nname: 198
n 198(None)[]:
	i: 144(AF), 163()
	o: 199()

nname: 163
n 163(None)[for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
img.set_keep_real_size(preserve_icon_size)
img.set_aspect(preserve_aspect=preserve_icon_aspect)
]:
	i: 144(for)
	o: 198()

nname: 144
n 144(None)[]:
	i: 0(loop)
	o: 163(for), 198(AF)

nname: 0
n 0(None)[style = self.style
icon_size = style['icon_size']
icon_size_sel = style['selected_icon_size']
item_size = style['item_size']
item_size_sel = style['selected_item_size']
text_offset = style['text_offset']
text_offset_sel = style['selected_text_offset']
thumbnail_sel = Image()
thumbnail_not_sel = Image()
background_sel = Image()
background_not_sel = Image()
preserve_icon_size = style.get('preserve_icon_size', 0)
preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
]:
	i: 
	o: 144(loop), 199(AL)

nname: 199
n 199(None)[thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
background_not_sel.resize(width=icon_size[0], height=icon_size[1])
thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
text_not_sel = TextBlock()
text_not_sel.set_color(color=style['text_color'])
text_sel = TextBlock()
text_sel.set_color(color=style['selected_text_color'])
self.text_not_sel = text_not_sel
self.text_sel = text_sel
self.thumbnail_not_sel = thumbnail_not_sel
self.thumbnail_sel = thumbnail_sel
self.background_not_sel = background_not_sel
self.background_sel = background_sel
c = Container()
c_sel = Container()
tw, th = style['text_size']
iw, ih = style['icon_size']
itw, ith = style['item_size']
c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
tw, th = style['selected_text_size']
iw, ih = style['selected_icon_size']
itw, ith = style['selected_item_size']
c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
return (c, c_sel)
]:
	i: 163()
	o: 

nname: 163
n 163(None)[for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
	img.set_keep_real_size(preserve_icon_size)
	img.set_aspect(preserve_aspect=preserve_icon_aspect)
]:
	i: 0(for)
	o: 199()

nname: 0
n 0(None)[style = self.style
icon_size = style['icon_size']
icon_size_sel = style['selected_icon_size']
item_size = style['item_size']
item_size_sel = style['selected_item_size']
text_offset = style['text_offset']
text_offset_sel = style['selected_text_offset']
thumbnail_sel = Image()
thumbnail_not_sel = Image()
background_sel = Image()
background_not_sel = Image()
preserve_icon_size = style.get('preserve_icon_size', 0)
preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
]:
	i: 
	o: 163(for)

nname: 199
n 199(None)[thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
background_not_sel.resize(width=icon_size[0], height=icon_size[1])
thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
text_not_sel = TextBlock()
text_not_sel.set_color(color=style['text_color'])
text_sel = TextBlock()
text_sel.set_color(color=style['selected_text_color'])
self.text_not_sel = text_not_sel
self.text_sel = text_sel
self.thumbnail_not_sel = thumbnail_not_sel
self.thumbnail_sel = thumbnail_sel
self.background_not_sel = background_not_sel
self.background_sel = background_sel
c = Container()
c_sel = Container()
tw, th = style['text_size']
iw, ih = style['icon_size']
itw, ith = style['item_size']
c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
tw, th = style['selected_text_size']
iw, ih = style['selected_icon_size']
itw, ith = style['selected_item_size']
c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
return (c, c_sel)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[style = self.style
icon_size = style['icon_size']
icon_size_sel = style['selected_icon_size']
item_size = style['item_size']
item_size_sel = style['selected_item_size']
text_offset = style['text_offset']
text_offset_sel = style['selected_text_offset']
thumbnail_sel = Image()
thumbnail_not_sel = Image()
background_sel = Image()
background_not_sel = Image()
preserve_icon_size = style.get('preserve_icon_size', 0)
preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
	img.set_keep_real_size(preserve_icon_size)
	img.set_aspect(preserve_aspect=preserve_icon_aspect)
]:
	i: 
	o: 199()

nname: 0
n 0(None)[style = self.style
icon_size = style['icon_size']
icon_size_sel = style['selected_icon_size']
item_size = style['item_size']
item_size_sel = style['selected_item_size']
text_offset = style['text_offset']
text_offset_sel = style['selected_text_offset']
thumbnail_sel = Image()
thumbnail_not_sel = Image()
background_sel = Image()
background_not_sel = Image()
preserve_icon_size = style.get('preserve_icon_size', 0)
preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
	img.set_keep_real_size(preserve_icon_size)
	img.set_aspect(preserve_aspect=preserve_icon_aspect)
thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
background_not_sel.resize(width=icon_size[0], height=icon_size[1])
thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
text_not_sel = TextBlock()
text_not_sel.set_color(color=style['text_color'])
text_sel = TextBlock()
text_sel.set_color(color=style['selected_text_color'])
self.text_not_sel = text_not_sel
self.text_sel = text_sel
self.thumbnail_not_sel = thumbnail_not_sel
self.thumbnail_sel = thumbnail_sel
self.background_not_sel = background_not_sel
self.background_sel = background_sel
c = Container()
c_sel = Container()
tw, th = style['text_size']
iw, ih = style['icon_size']
itw, ith = style['item_size']
c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
tw, th = style['selected_text_size']
iw, ih = style['selected_icon_size']
itw, ith = style['selected_item_size']
c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
return (c, c_sel)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76cb20c>}
nname: 0
n 0(None)[style = self.style
marker = Image(style['marker_image'], style['repository'])
iw, ih = style['selected_icon_size']
self.widget.add_child(marker, name='marker', aspect=0, width='1%', height=add_to_percent(5, ih), hcenter='50%', vcenter='50%')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb772afec>}
nname: 51
n 51(None)[duration = 0
iw, ih = self.style['selected_icon_size']
marker.show()
marker.animate('size', width=iw, duration=duration)
marker.animate('color', a=255, duration=duration)
return None
]:
	i: 33(), 47()
	o: 

nname: 47
n 47(None)[]:
	i: 0(f)
	o: 51()

nname: 33
n 33(None)[]:
	i: 0(t)
	o: 51()

nname: 0
n 0(animate)[marker = self.widget.get_obj_by_name('marker')
marker._end_callback = None
]:
	i: 
	o: 33(t), 47(f)

nname: 0
n 0(None)[marker = self.widget.get_obj_by_name('marker')
marker._end_callback = None
if animate:
	pass
duration = 0
iw, ih = self.style['selected_icon_size']
marker.show()
marker.animate('size', width=iw, duration=duration)
marker.animate('color', a=255, duration=duration)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb772abcc>}
nname: 51
n 51(None)[duration = 0
marker.animate('size', width='1%', duration=duration)
marker.animate('color', a=0, duration=duration, end_callback=marker.hide)
return None
]:
	i: 33(), 47()
	o: 

nname: 47
n 47(None)[]:
	i: 0(f)
	o: 51()

nname: 33
n 33(None)[]:
	i: 0(t)
	o: 51()

nname: 0
n 0(animate)[marker = self.widget.get_obj_by_name('marker')
marker._end_callback = None
]:
	i: 
	o: 33(t), 47(f)

nname: 0
n 0(None)[marker = self.widget.get_obj_by_name('marker')
marker._end_callback = None
if animate:
	pass
duration = 0
marker.animate('size', width='1%', duration=duration)
marker.animate('color', a=0, duration=duration, end_callback=marker.hide)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb772a62c>}
nname: 6
n 6(None)[__slots__ = ['_selected', '_marked', '_position', '_edited', 'widget', 'style', 'selected_style_string', 'not_selected_style_string', 'text_sel', 'text_not_sel', 'thumbnail_sel', 'thumbnail_not_sel', 'text_offset', 'selected_text_offset', '_not_selected_widget', '_selected_widget', 'background_sel', 'background_not_sel']
def __init__(self, *args, **args):
	UIItem.__init__(self, *args, **kw)
	self.selected_style_string = xml_tag(self.style['selected_font_style'].replace('%', '%%'), '%s')
	self.not_selected_style_string = xml_tag(self.style['font_style'].replace('%', '%%'), '%s')

def _get_images_paths(self, item):
	repository = self.style['repository']
	root = path.join(repository, '%s' % item.type)
	suff = ('.', '_selected.')
	def check_concat(suf):
		_name = root + suf
		for ext in self.style['extension']:
			name = _name + ext
			if path.isfile(name):
				return name
				continue
		log.debug("%s don't exist" % name)
		return None

	return map(check_concat, suff)

def reset(self, item, selected, position):
	UIItem.reset(self, item, selected)

def _create(self):
	style = self.style
	icon_size = style['icon_size']
	icon_size_sel = style['selected_icon_size']
	item_size = style['item_size']
	item_size_sel = style['selected_item_size']
	text_offset = style['text_offset']
	text_offset_sel = style['selected_text_offset']
	thumbnail_sel = Image()
	thumbnail_not_sel = Image()
	background_sel = Image()
	background_not_sel = Image()
	preserve_icon_size = style.get('preserve_icon_size', 0)
	preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
	for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
		img.set_keep_real_size(preserve_icon_size)
		img.set_aspect(preserve_aspect=preserve_icon_aspect)
	thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
	background_not_sel.resize(width=icon_size[0], height=icon_size[1])
	thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
	background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
	text_not_sel = TextBlock()
	text_not_sel.set_color(color=style['text_color'])
	text_sel = TextBlock()
	text_sel.set_color(color=style['selected_text_color'])
	self.text_not_sel = text_not_sel
	self.text_sel = text_sel
	self.thumbnail_not_sel = thumbnail_not_sel
	self.thumbnail_sel = thumbnail_sel
	self.background_not_sel = background_not_sel
	self.background_sel = background_sel
	c = Container()
	c_sel = Container()
	tw, th = style['text_size']
	iw, ih = style['icon_size']
	itw, ith = style['item_size']
	c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
	c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
	c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
	tw, th = style['selected_text_size']
	iw, ih = style['selected_icon_size']
	itw, ith = style['selected_item_size']
	c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
	c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
	c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
	return (c, c_sel)

def _create_marker(self):
	style = self.style
	marker = Image(style['marker_image'], style['repository'])
	iw, ih = style['selected_icon_size']
	self.widget.add_child(marker, name='marker', aspect=0, width='1%', height=add_to_percent(5, ih), hcenter='50%', vcenter='50%')

def mark(self, animate):
	marker = self.widget.get_obj_by_name('marker')
	marker._end_callback = None
	if animate:
		pass
	duration = 0
	iw, ih = self.style['selected_icon_size']
	marker.show()
	marker.animate('size', width=iw, duration=duration)
	marker.animate('color', a=255, duration=duration)
	return None

def unmark(self, animate):
	marker = self.widget.get_obj_by_name('marker')
	marker._end_callback = None
	if animate:
		pass
	duration = 0
	marker.animate('size', width='1%', duration=duration)
	marker.animate('color', a=0, duration=duration, end_callback=marker.hide)
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7725b8c>}
nname: 0
n 0(None)[return int_to_percent(percent_to_int(p) + x)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77255ec>}
nname: 0
n 0(None)[from __future__ import absolute_import
from os import path
from .ui_items import UIItem
from wyvas import Image, TextBlock, Container
from peewee.debug import GET_LOGGER
from peewee.formatters import int_to_percent, percent_to_int, xml_tag
log = GET_LOGGER(__name__)
class ThumbnailItem(UIItem):
	__slots__ = ['_selected', '_marked', '_position', '_edited', 'widget', 'style', 'selected_style_string', 'not_selected_style_string', 'text_sel', 'text_not_sel', 'thumbnail_sel', 'thumbnail_not_sel', 'text_offset', 'selected_text_offset', '_not_selected_widget', '_selected_widget', 'background_sel', 'background_not_sel']
	def __init__(self, *args, **args):
		UIItem.__init__(self, *args, **kw)
		self.selected_style_string = xml_tag(self.style['selected_font_style'].replace('%', '%%'), '%s')
		self.not_selected_style_string = xml_tag(self.style['font_style'].replace('%', '%%'), '%s')

	def _get_images_paths(self, item):
		repository = self.style['repository']
		root = path.join(repository, '%s' % item.type)
		suff = ('.', '_selected.')
		def check_concat(suf):
			_name = root + suf
			for ext in self.style['extension']:
				name = _name + ext
				if path.isfile(name):
					return name
					continue
			log.debug("%s don't exist" % name)
			return None

		return map(check_concat, suff)

	def reset(self, item, selected, position):
		UIItem.reset(self, item, selected)

	def _create(self):
		style = self.style
		icon_size = style['icon_size']
		icon_size_sel = style['selected_icon_size']
		item_size = style['item_size']
		item_size_sel = style['selected_item_size']
		text_offset = style['text_offset']
		text_offset_sel = style['selected_text_offset']
		thumbnail_sel = Image()
		thumbnail_not_sel = Image()
		background_sel = Image()
		background_not_sel = Image()
		preserve_icon_size = style.get('preserve_icon_size', 0)
		preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
		for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
			img.set_keep_real_size(preserve_icon_size)
			img.set_aspect(preserve_aspect=preserve_icon_aspect)
		thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
		background_not_sel.resize(width=icon_size[0], height=icon_size[1])
		thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
		background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
		text_not_sel = TextBlock()
		text_not_sel.set_color(color=style['text_color'])
		text_sel = TextBlock()
		text_sel.set_color(color=style['selected_text_color'])
		self.text_not_sel = text_not_sel
		self.text_sel = text_sel
		self.thumbnail_not_sel = thumbnail_not_sel
		self.thumbnail_sel = thumbnail_sel
		self.background_not_sel = background_not_sel
		self.background_sel = background_sel
		c = Container()
		c_sel = Container()
		tw, th = style['text_size']
		iw, ih = style['icon_size']
		itw, ith = style['item_size']
		c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
		c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
		c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
		tw, th = style['selected_text_size']
		iw, ih = style['selected_icon_size']
		itw, ith = style['selected_item_size']
		c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
		c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
		c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
		return (c, c_sel)

	def _create_marker(self):
		style = self.style
		marker = Image(style['marker_image'], style['repository'])
		iw, ih = style['selected_icon_size']
		self.widget.add_child(marker, name='marker', aspect=0, width='1%', height=add_to_percent(5, ih), hcenter='50%', vcenter='50%')

	def mark(self, animate):
		marker = self.widget.get_obj_by_name('marker')
		marker._end_callback = None
		if animate:
			pass
		duration = 0
		iw, ih = self.style['selected_icon_size']
		marker.show()
		marker.animate('size', width=iw, duration=duration)
		marker.animate('color', a=255, duration=duration)
		return None

	def unmark(self, animate):
		marker = self.widget.get_obj_by_name('marker')
		marker._end_callback = None
		if animate:
			pass
		duration = 0
		marker.animate('size', width='1%', duration=duration)
		marker.animate('color', a=0, duration=duration, end_callback=marker.hide)
		return None



def add_to_percent(x, p):
	return int_to_percent(percent_to_int(p) + x)

]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb771ca2c>}
from __future__ import absolute_import
from os import path
from .ui_items import UIItem
from wyvas import Image, TextBlock, Container
from peewee.debug import GET_LOGGER
from peewee.formatters import int_to_percent, percent_to_int, xml_tag
log = GET_LOGGER(__name__)
class ThumbnailItem(UIItem):
	__slots__ = ['_selected', '_marked', '_position', '_edited', 'widget', 'style', 'selected_style_string', 'not_selected_style_string', 'text_sel', 'text_not_sel', 'thumbnail_sel', 'thumbnail_not_sel', 'text_offset', 'selected_text_offset', '_not_selected_widget', '_selected_widget', 'background_sel', 'background_not_sel']
	def __init__(self, *args, **args):
		UIItem.__init__(self, *args, **kw)
		self.selected_style_string = xml_tag(self.style['selected_font_style'].replace('%', '%%'), '%s')
		self.not_selected_style_string = xml_tag(self.style['font_style'].replace('%', '%%'), '%s')

	def _get_images_paths(self, item):
		repository = self.style['repository']
		root = path.join(repository, '%s' % item.type)
		suff = ('.', '_selected.')
		def check_concat(suf):
			_name = root + suf
			for ext in self.style['extension']:
				name = _name + ext
				if path.isfile(name):
					return name
					continue
			log.debug("%s don't exist" % name)
			return None

		return map(check_concat, suff)

	def reset(self, item, selected, position):
		UIItem.reset(self, item, selected)

	def _create(self):
		style = self.style
		icon_size = style['icon_size']
		icon_size_sel = style['selected_icon_size']
		item_size = style['item_size']
		item_size_sel = style['selected_item_size']
		text_offset = style['text_offset']
		text_offset_sel = style['selected_text_offset']
		thumbnail_sel = Image()
		thumbnail_not_sel = Image()
		background_sel = Image()
		background_not_sel = Image()
		preserve_icon_size = style.get('preserve_icon_size', 0)
		preserve_icon_aspect = style.get('preserve_icon_aspect', 0)
		for img in (thumbnail_sel, thumbnail_not_sel, background_not_sel, background_sel):
			img.set_keep_real_size(preserve_icon_size)
			img.set_aspect(preserve_aspect=preserve_icon_aspect)
		thumbnail_not_sel.resize(width=item_size[0], height=item_size[1])
		background_not_sel.resize(width=icon_size[0], height=icon_size[1])
		thumbnail_sel.resize(width=item_size_sel[0], height=item_size_sel[1])
		background_sel.resize(width=icon_size_sel[0], height=icon_size_sel[1])
		text_not_sel = TextBlock()
		text_not_sel.set_color(color=style['text_color'])
		text_sel = TextBlock()
		text_sel.set_color(color=style['selected_text_color'])
		self.text_not_sel = text_not_sel
		self.text_sel = text_sel
		self.thumbnail_not_sel = thumbnail_not_sel
		self.thumbnail_sel = thumbnail_sel
		self.background_not_sel = background_not_sel
		self.background_sel = background_sel
		c = Container()
		c_sel = Container()
		tw, th = style['text_size']
		iw, ih = style['icon_size']
		itw, ith = style['item_size']
		c.add_child(text_not_sel, name='text_not_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset[0])), layer=3)
		c.add_child(background_not_sel, name='background_not_sel', hcenter='50%', vcenter='50%', layer=1)
		c.add_child(thumbnail_not_sel, name='thumbnail_not_sel', hcenter='50%', vcenter='50%', layer=2)
		tw, th = style['selected_text_size']
		iw, ih = style['selected_icon_size']
		itw, ith = style['selected_item_size']
		c_sel.add_child(text_sel, name='text_sel', width=tw, height=th, vcenter=int_to_percent(50 + percent_to_int(text_offset_sel[1])), hcenter=int_to_percent(50 + percent_to_int(text_offset_sel[0])), layer=3)
		c_sel.add_child(background_sel, name='background_sel', hcenter='50%', vcenter='50%', layer=1)
		c_sel.add_child(thumbnail_sel, name='thumbnail_sel', hcenter='50%', vcenter='50%', layer=2)
		return (c, c_sel)

	def _create_marker(self):
		style = self.style
		marker = Image(style['marker_image'], style['repository'])
		iw, ih = style['selected_icon_size']
		self.widget.add_child(marker, name='marker', aspect=0, width='1%', height=add_to_percent(5, ih), hcenter='50%', vcenter='50%')

	def mark(self, animate):
		marker = self.widget.get_obj_by_name('marker')
		marker._end_callback = None
		if animate:
			pass
		duration = 0
		iw, ih = self.style['selected_icon_size']
		marker.show()
		marker.animate('size', width=iw, duration=duration)
		marker.animate('color', a=255, duration=duration)
		return None

	def unmark(self, animate):
		marker = self.widget.get_obj_by_name('marker')
		marker._end_callback = None
		if animate:
			pass
		duration = 0
		marker.animate('size', width='1%', duration=duration)
		marker.animate('color', a=0, duration=duration, end_callback=marker.hide)
		return None



def add_to_percent(x, p):
	return int_to_percent(percent_to_int(p) + x)

